package com.work.demo.utils;

import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.asymmetric.Sign;
import cn.hutool.crypto.asymmetric.SignAlgorithm;

import java.util.Arrays;

public class Tsdsad {
	public static void main(String[] args) {
		byte[] data = "我是一段测试字符串".getBytes();
		System.out.println(Arrays.toString(data));
		Sign sign = SecureUtil.sign(SignAlgorithm.SHA256withRSA);
		System.out.println(sign);
//签名
		byte[] signed = sign.sign(data);
		System.out.println(Arrays.toString(signed));
//验证签名
		boolean verify = sign.verify(data, signed);
		System.out.println(verify);


	}
}
